package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo2 {
    public static void main(String[] args) {
        Map<String,Integer>map=new HashMap<>();
        map.put("语文",90);
        map.put("数学",96);
        map.put("英语",99);
        map.put("物理",97);
        map.put("化学",92);
        System.out.println(map);

        Integer value=map.get("语文");
        System.out.println(value);

        value = map.get("体育");
        System.out.println(value);//null

        System.out.println("map大小为："+map.size());
        System.out.println("map是否为空集"+map.isEmpty());
        System.out.println("map是否包含化学这个键："+map.containsKey("化学"));
        System.out.println("map是否包含99这个值："+map.containsValue(99));

        map.remove("数学");
        System.out.println(map);

        value = map.remove("英语");
        System.out.println(value);
        System.out.println(map);

        map.clear();
        System.out.println(map);

    }

}
